export function formatTimestamp(timestamp) {
    const now = Date.now(); // 获取当前时间戳
    const difference = now - timestamp; // 计算时间差

    const oneMinute = 60 * 1000; // 一分钟的毫秒数
    const oneHour = 60 * oneMinute; // 一小时的毫秒数
    const oneDay = 24 * oneHour; // 一天的毫秒数
    const threeMonths = 3 * 30 * oneDay; // 三个月的毫秒数

    if (difference < oneMinute) {
        return '1分钟内';
    } else if (difference < oneHour) {
        const minutes = Math.floor(difference / oneMinute);
        return `${minutes}分钟前`;
    } else if (difference < oneDay) {
        const hours = Math.floor(difference / oneHour);
        return `${hours}小时前`;
    } else if (difference < threeMonths) {
        const days = Math.floor(difference / oneDay);
        return `${days}天前`;
    } else {
        return null; // 超过三个月返回null
    }
}
export function gotoHome(){
	uni.showModal({
		title:"提示",
		content:"页面有误将返回首页",
		showCancel:false,
		success: (e) => {
			if (e.confirm) {
				uni.reLaunch({
					url:"/pages/index/index"
				})
			}
		}
	})
}